package com.ymttest.database.sqlwapper;

import java.util.List;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.CSLocalReturn;
import com.ymttest.database.model.CSLocalReturnImage;
import com.ymttest.utils.EnvSetup;

/************************************************************************************
 * @File name : YmtUserWapper.java
 * @Author : zhouyi
 * @Date : 2015年4月2日
 * @Copyright : 洋码头
 ************************************************************************************/
public class YmtCSLocalReturnWapper {
	SqlManager manage;

	public YmtCSLocalReturnWapper() {
		manage = new SqlManager("ymt" + EnvSetup.getEnv());
	}

	/**
	 * 使用ReturnOrderid查询记录列表
	 * 
	 * @param ReturnOrderid
	 * @return 记录列表
	 * @throws InterruptedException
	 */
	public List<CSLocalReturn> selectByReturnOrderid(String ReturnOrderid) throws InterruptedException {
		List<CSLocalReturn> csList = manage.getSelectResults(
				"com.ymttest.database.mapping.CSLocalReturnMapper.selectByReturnOrderid", ReturnOrderid);
		return csList;
	}

	public List<CSLocalReturnImage> selectByReturnid(String Returnid) throws InterruptedException {
		List<CSLocalReturnImage> csiList = manage.getSelectResults(
				"com.ymttest.database.mapping.CSLocalReturnImageMapper.selectByReturnid", Returnid);
		return csiList;
	}

	/**
	 * 关闭数据库连接
	 */
	public void close() {
		manage.close();
	}

	@Override
	protected void finalize() throws Throwable {
		this.close();
		manage = null;
		super.finalize();
	}

	public static void main(String args[]) {
		try {
			YmtCSLocalReturnWapper ycs = new YmtCSLocalReturnWapper();
			Logger.debug(ycs.selectByReturnid("02ac8195-eb9b-4589-bedf-82e37326c0fe").get(0).getImgurl());
			Logger.debug(ycs.selectByReturnOrderid("100159549").get(0).getReturnid());
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		// Logger.debug(new YmtUsersWapper().getLoginId(3383));
	}
}
